<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: hardware_sha256</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.0.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__hardware__sha256.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">hardware_sha256<div class="ingroups"><a class="el" href="group__hardware.html">Hardware APIs</a></div></div></div>
</div><!--header-->
<div class="contents">

<p>Hardware SHA-256 Accelerator API.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">union &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="unionsha256__result__t.html">sha256_result_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">SHA-256 result generated by the API.  <a href="unionsha256__result__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga08a18381a4c5a7c9f7d0d1b6550621a3"><td class="memItemLeft" align="right" valign="top"><a id="ga08a18381a4c5a7c9f7d0d1b6550621a3" name="ga08a18381a4c5a7c9f7d0d1b6550621a3"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>SHA256_RESULT_BYTES</b>&#160;&#160;&#160;32</td></tr>
<tr class="memdesc:ga08a18381a4c5a7c9f7d0d1b6550621a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Size of a sha256 result in bytes. <br /></td></tr>
<tr class="separator:ga08a18381a4c5a7c9f7d0d1b6550621a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gaaf3089af3667088256de5d352973d5e6"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a> { <a class="el" href="group__hardware__sha256.html#ggaaf3089af3667088256de5d352973d5e6af7be52b37d04b7ffbd9ba69ba6cad8fd">SHA256_LITTLE_ENDIAN</a>
, <a class="el" href="group__hardware__sha256.html#ggaaf3089af3667088256de5d352973d5e6a9ed40fa208beaabfc2fc5b8edbd652c1">SHA256_BIG_ENDIAN</a>
 }</td></tr>
<tr class="memdesc:gaaf3089af3667088256de5d352973d5e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">SHA-256 endianness definition used in the API.  <a href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">More...</a><br /></td></tr>
<tr class="separator:gaaf3089af3667088256de5d352973d5e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga4f35e6d85d8991216e9c1edd7e682cc7"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga4f35e6d85d8991216e9c1edd7e682cc7">sha256_set_dma_size</a> (uint size_in_bytes)</td></tr>
<tr class="memdesc:ga4f35e6d85d8991216e9c1edd7e682cc7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure the correct DMA data size.  <a href="group__hardware__sha256.html#ga4f35e6d85d8991216e9c1edd7e682cc7">More...</a><br /></td></tr>
<tr class="separator:ga4f35e6d85d8991216e9c1edd7e682cc7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga21bca5a93ccad014cc890e734c9436eb"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga21bca5a93ccad014cc890e734c9436eb">sha256_set_bswap</a> (bool swap)</td></tr>
<tr class="memdesc:ga21bca5a93ccad014cc890e734c9436eb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable or disable byte swapping of 32-bit values.  <a href="group__hardware__sha256.html#ga21bca5a93ccad014cc890e734c9436eb">More...</a><br /></td></tr>
<tr class="separator:ga21bca5a93ccad014cc890e734c9436eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga327d4bf2af7a8291cc402c569392b4d7"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga327d4bf2af7a8291cc402c569392b4d7">sha256_start</a> (void)</td></tr>
<tr class="memdesc:ga327d4bf2af7a8291cc402c569392b4d7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepare the hardware for a new checksum.  <a href="group__hardware__sha256.html#ga327d4bf2af7a8291cc402c569392b4d7">More...</a><br /></td></tr>
<tr class="separator:ga327d4bf2af7a8291cc402c569392b4d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7e4f6ab4a7738c38d094ecd4c5ee9839"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga7e4f6ab4a7738c38d094ecd4c5ee9839">sha256_is_sum_valid</a> (void)</td></tr>
<tr class="memdesc:ga7e4f6ab4a7738c38d094ecd4c5ee9839"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a valid checksum has been calculated.  <a href="group__hardware__sha256.html#ga7e4f6ab4a7738c38d094ecd4c5ee9839">More...</a><br /></td></tr>
<tr class="separator:ga7e4f6ab4a7738c38d094ecd4c5ee9839"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga586dc580abe393a0eb4af052da4f9050"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga586dc580abe393a0eb4af052da4f9050">sha256_is_ready</a> (void)</td></tr>
<tr class="memdesc:ga586dc580abe393a0eb4af052da4f9050"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a the hardware is ready to accept more data.  <a href="group__hardware__sha256.html#ga586dc580abe393a0eb4af052da4f9050">More...</a><br /></td></tr>
<tr class="separator:ga586dc580abe393a0eb4af052da4f9050"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga98114068a397971354cd24ae75d051a6"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga98114068a397971354cd24ae75d051a6">sha256_wait_valid_blocking</a> (void)</td></tr>
<tr class="memdesc:ga98114068a397971354cd24ae75d051a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait until the checksum is valid.  <a href="group__hardware__sha256.html#ga98114068a397971354cd24ae75d051a6">More...</a><br /></td></tr>
<tr class="separator:ga98114068a397971354cd24ae75d051a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaab29e83e6d914d262e9aaf13ed34f06e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#gaab29e83e6d914d262e9aaf13ed34f06e">sha256_wait_ready_blocking</a> (void)</td></tr>
<tr class="memdesc:gaab29e83e6d914d262e9aaf13ed34f06e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait until the hardware is ready to accept more data.  <a href="group__hardware__sha256.html#gaab29e83e6d914d262e9aaf13ed34f06e">More...</a><br /></td></tr>
<tr class="separator:gaab29e83e6d914d262e9aaf13ed34f06e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga065f30a83c4d96ea85712a0e22f7a62e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga065f30a83c4d96ea85712a0e22f7a62e">sha256_get_result</a> (<a class="el" href="unionsha256__result__t.html">sha256_result_t</a> *out, enum <a class="el" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a> endianness)</td></tr>
<tr class="memdesc:ga065f30a83c4d96ea85712a0e22f7a62e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the checksum result.  <a href="group__hardware__sha256.html#ga065f30a83c4d96ea85712a0e22f7a62e">More...</a><br /></td></tr>
<tr class="separator:ga065f30a83c4d96ea85712a0e22f7a62e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab26b08aabc454e46859d38acdb9afb63"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#gab26b08aabc454e46859d38acdb9afb63">sha256_err_not_ready</a> (void)</td></tr>
<tr class="memdesc:gab26b08aabc454e46859d38acdb9afb63"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if data was written before the hardware was ready.  <a href="group__hardware__sha256.html#gab26b08aabc454e46859d38acdb9afb63">More...</a><br /></td></tr>
<tr class="separator:gab26b08aabc454e46859d38acdb9afb63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaccd81a57687cf83726d87b5da4e63551"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#gaccd81a57687cf83726d87b5da4e63551">sha256_err_not_ready_clear</a> (void)</td></tr>
<tr class="memdesc:gaccd81a57687cf83726d87b5da4e63551"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear the "not ready" error condition.  <a href="group__hardware__sha256.html#gaccd81a57687cf83726d87b5da4e63551">More...</a><br /></td></tr>
<tr class="separator:gaccd81a57687cf83726d87b5da4e63551"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac7b585e60910cf0e1d927a0824cd0fe1"><td class="memItemLeft" align="right" valign="top">static volatile void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#gac7b585e60910cf0e1d927a0824cd0fe1">sha256_get_write_addr</a> (void)</td></tr>
<tr class="memdesc:gac7b585e60910cf0e1d927a0824cd0fe1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Address to write the data to be hashed.  <a href="group__hardware__sha256.html#gac7b585e60910cf0e1d927a0824cd0fe1">More...</a><br /></td></tr>
<tr class="separator:gac7b585e60910cf0e1d927a0824cd0fe1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7d391fa299a4e4f91c591c2e27c82295"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#ga7d391fa299a4e4f91c591c2e27c82295">sha256_put_word</a> (uint32_t word)</td></tr>
<tr class="memdesc:ga7d391fa299a4e4f91c591c2e27c82295"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write one 32bit word of data to the SHA-256 hardware.  <a href="group__hardware__sha256.html#ga7d391fa299a4e4f91c591c2e27c82295">More...</a><br /></td></tr>
<tr class="separator:ga7d391fa299a4e4f91c591c2e27c82295"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa78f58e44c56c61c3e24c119923f28d4"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__sha256.html#gaa78f58e44c56c61c3e24c119923f28d4">sha256_put_byte</a> (uint8_t b)</td></tr>
<tr class="memdesc:gaa78f58e44c56c61c3e24c119923f28d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write one byte of data to the SHA-256 hardware.  <a href="group__hardware__sha256.html#gaa78f58e44c56c61c3e24c119923f28d4">More...</a><br /></td></tr>
<tr class="separator:gaa78f58e44c56c61c3e24c119923f28d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p >Hardware SHA-256 Accelerator API. </p>
<p >RP2350 is equipped with an implementation of the SHA-256 hash algorithm. The hardware should first be configured by calling the <a class="el" href="group__hardware__sha256.html#ga4f35e6d85d8991216e9c1edd7e682cc7">sha256_set_dma_size</a> and <a class="el" href="group__hardware__sha256.html#ga21bca5a93ccad014cc890e734c9436eb">sha256_set_bswap</a> functions. To generate a new hash the hardware should first be initialised by calling <a class="el" href="group__hardware__sha256.html#ga327d4bf2af7a8291cc402c569392b4d7">sha256_start</a>. The hardware is ready to accept data when <a class="el" href="group__hardware__sha256.html#ga586dc580abe393a0eb4af052da4f9050">sha256_is_ready</a> returns true, at which point the data to be hashed can be written to the address returned by <a class="el" href="group__hardware__sha256.html#gac7b585e60910cf0e1d927a0824cd0fe1">sha256_get_write_addr</a>. The hardware requires 64 bytes to be written in one go or else <a class="el" href="group__hardware__sha256.html#gab26b08aabc454e46859d38acdb9afb63">sha256_err_not_ready</a> will indicate an error and the hashing process must be restarted. <a class="el" href="group__hardware__sha256.html#ga7e4f6ab4a7738c38d094ecd4c5ee9839">sha256_is_sum_valid</a> will return true when there is a valid checksum result which can be retrieved by calling <a class="el" href="group__hardware__sha256.html#ga065f30a83c4d96ea85712a0e22f7a62e">sha256_get_result</a>. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gaaf3089af3667088256de5d352973d5e6" name="gaaf3089af3667088256de5d352973d5e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaaf3089af3667088256de5d352973d5e6">&#9670;&nbsp;</a></span>sha256_endianness</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>SHA-256 endianness definition used in the API. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggaaf3089af3667088256de5d352973d5e6af7be52b37d04b7ffbd9ba69ba6cad8fd" name="ggaaf3089af3667088256de5d352973d5e6af7be52b37d04b7ffbd9ba69ba6cad8fd"></a>SHA256_LITTLE_ENDIAN&#160;</td><td class="fielddoc"><p >Little Endian. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaaf3089af3667088256de5d352973d5e6a9ed40fa208beaabfc2fc5b8edbd652c1" name="ggaaf3089af3667088256de5d352973d5e6a9ed40fa208beaabfc2fc5b8edbd652c1"></a>SHA256_BIG_ENDIAN&#160;</td><td class="fielddoc"><p >Big Endian. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gab26b08aabc454e46859d38acdb9afb63" name="gab26b08aabc454e46859d38acdb9afb63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab26b08aabc454e46859d38acdb9afb63">&#9670;&nbsp;</a></span>sha256_err_not_ready()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool sha256_err_not_ready </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Check if data was written before the hardware was ready. </p>
<p >Indicates if an error has occurred due to data being written when the hardware is not ready.</p>
<dl class="section return"><dt>Returns</dt><dd>True if data was written before the hardware was ready </dd></dl>

</div>
</div>
<a id="gaccd81a57687cf83726d87b5da4e63551" name="gaccd81a57687cf83726d87b5da4e63551"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaccd81a57687cf83726d87b5da4e63551">&#9670;&nbsp;</a></span>sha256_err_not_ready_clear()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_err_not_ready_clear </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Clear the "not ready" error condition. </p>
<p >Resets the hardware if a "not ready" error condition is indicated. </p>

</div>
</div>
<a id="ga065f30a83c4d96ea85712a0e22f7a62e" name="ga065f30a83c4d96ea85712a0e22f7a62e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga065f30a83c4d96ea85712a0e22f7a62e">&#9670;&nbsp;</a></span>sha256_get_result()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sha256_get_result </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="unionsha256__result__t.html">sha256_result_t</a> *&#160;</td>
          <td class="paramname"><em>out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a>&#160;</td>
          <td class="paramname"><em>endianness</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the checksum result. </p>
<p >Read the 32 byte result calculated by the hardware. Only valid if <a class="el" href="group__hardware__sha256.html#ga7e4f6ab4a7738c38d094ecd4c5ee9839">sha256_is_sum_valid</a> is True</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">out</td><td>The checksum result</td></tr>
  </table>
  </dd>
</dl>
<p>Copyright (c) 2024 Raspberry Pi (Trading) Ltd.</p>
<p >SPDX-License-Identifier: BSD-3-Clause </p>

</div>
</div>
<a id="gac7b585e60910cf0e1d927a0824cd0fe1" name="gac7b585e60910cf0e1d927a0824cd0fe1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac7b585e60910cf0e1d927a0824cd0fe1">&#9670;&nbsp;</a></span>sha256_get_write_addr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static volatile void * sha256_get_write_addr </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Address to write the data to be hashed. </p>
<p >Returns the hardware address where data to be hashed should be written</p>
<dl class="section return"><dt>Returns</dt><dd>Address to write data to be hashed </dd></dl>

</div>
</div>
<a id="ga586dc580abe393a0eb4af052da4f9050" name="ga586dc580abe393a0eb4af052da4f9050"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga586dc580abe393a0eb4af052da4f9050">&#9670;&nbsp;</a></span>sha256_is_ready()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool sha256_is_ready </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Check if a the hardware is ready to accept more data. </p>
<p >After writing 64 bytes of data to the hardware, it will be unable to accept more data for a time. Call this to check if the hardware is ready for more data to be written. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="group__hardware__sha256.html#gab26b08aabc454e46859d38acdb9afb63" title="Check if data was written before the hardware was ready.">sha256_err_not_ready</a></dd></dl>
<dl class="section return"><dt>Returns</dt><dd>True if the hardware is ready to receive more data </dd></dl>

</div>
</div>
<a id="ga7e4f6ab4a7738c38d094ecd4c5ee9839" name="ga7e4f6ab4a7738c38d094ecd4c5ee9839"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7e4f6ab4a7738c38d094ecd4c5ee9839">&#9670;&nbsp;</a></span>sha256_is_sum_valid()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool sha256_is_sum_valid </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Check if a valid checksum has been calculated. </p>
<p >The checksum result will be invalid when data is first written to the hardware, and then once 64 bytes of data has been written it may take some time to complete the digest of the current block. This function can be used to determine when the checksum is valid.</p>
<dl class="section return"><dt>Returns</dt><dd>True if <a class="el" href="group__hardware__sha256.html#ga065f30a83c4d96ea85712a0e22f7a62e">sha256_get_result</a> would return a valid result </dd></dl>

</div>
</div>
<a id="gaa78f58e44c56c61c3e24c119923f28d4" name="gaa78f58e44c56c61c3e24c119923f28d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa78f58e44c56c61c3e24c119923f28d4">&#9670;&nbsp;</a></span>sha256_put_byte()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_put_byte </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>b</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Write one byte of data to the SHA-256 hardware. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">b</td><td>data to write </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga7d391fa299a4e4f91c591c2e27c82295" name="ga7d391fa299a4e4f91c591c2e27c82295"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7d391fa299a4e4f91c591c2e27c82295">&#9670;&nbsp;</a></span>sha256_put_word()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_put_word </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>word</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Write one 32bit word of data to the SHA-256 hardware. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">word</td><td>data to write </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga21bca5a93ccad014cc890e734c9436eb" name="ga21bca5a93ccad014cc890e734c9436eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga21bca5a93ccad014cc890e734c9436eb">&#9670;&nbsp;</a></span>sha256_set_bswap()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_set_bswap </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>swap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable or disable byte swapping of 32-bit values. </p>
<p >The SHA256 algorithm expects bytes in big endian order, but the system bus deals with little endian data, so control is provided to convert little endian bus data to big endian internal data. This defaults to true</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">swap</td><td>false to disable byte swapping </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga4f35e6d85d8991216e9c1edd7e682cc7" name="ga4f35e6d85d8991216e9c1edd7e682cc7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4f35e6d85d8991216e9c1edd7e682cc7">&#9670;&nbsp;</a></span>sha256_set_dma_size()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_set_dma_size </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>size_in_bytes</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Configure the correct DMA data size. </p>
<p >This must be configured before the DMA channel is triggered and ensures the correct number of transfers is requested per block.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size_in_bytes</td><td>Size of DMA transfers, either 1, 2 or 4 bytes only. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga327d4bf2af7a8291cc402c569392b4d7" name="ga327d4bf2af7a8291cc402c569392b4d7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga327d4bf2af7a8291cc402c569392b4d7">&#9670;&nbsp;</a></span>sha256_start()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_start </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Prepare the hardware for a new checksum. </p>
<p >Called to initialise the hardware before starting the checksum calculation </p>

</div>
</div>
<a id="gaab29e83e6d914d262e9aaf13ed34f06e" name="gaab29e83e6d914d262e9aaf13ed34f06e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaab29e83e6d914d262e9aaf13ed34f06e">&#9670;&nbsp;</a></span>sha256_wait_ready_blocking()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_wait_ready_blocking </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Wait until the hardware is ready to accept more data. </p>
<p >Before writing to the hardware, it's necessary to check it is ready to accept more data. This function waits until the hardware is ready to accept more data </p>

</div>
</div>
<a id="ga98114068a397971354cd24ae75d051a6" name="ga98114068a397971354cd24ae75d051a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga98114068a397971354cd24ae75d051a6">&#9670;&nbsp;</a></span>sha256_wait_valid_blocking()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void sha256_wait_valid_blocking </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Wait until the checksum is valid. </p>
<p >When a multiple of 64 bytes of data has been written to the hardware, the checksum will be valid once the digest of the current block is complete. This function waits until when the checksum result is valid. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>